from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time

driver = webdriver.Chrome(executable_path="C:\\chromedriver")


driver.get("http://mail.126.com/")
driver.find_element_by_id("switchAccountLogin").click()
time.sleep(5)
driver.switch_to.frame(0)
username = driver.find_element_by_xpath('//input[@name = "email"]')
username.send_keys("wyu0430")
pwd = driver.find_element_by_xpath("//input[@name='password']")
pwd.send_keys("19870303")
# pwd.send_keys(Keys.ENTER)
driver.find_element(by="id",value="dologin").click()
time.sleep(2)


# driver.find_element_by_xpath('//div[text()="通讯录"]').click()
# time.sleep(2)
# driver.find_element_by_xpath('//span[text() = "新建联系人"]').click()
# time.sleep(2)
# driver.find_element_by_id('input_N').send_keys("lucy")
# driver.find_element_by_xpath('//*[@id="iaddress_MAIL_wrap"]//input').send_keys("test1@163.com")
# driver.find_element_by_xpath('//div[@id = "iaddress_TEL_wrap"]//dd//input').send_keys('18190909372')
# driver.find_element_by_xpath('//*[@id="input_DETAIL"]').send_keys("朋友")
# driver.find_element_by_xpath('//span[text() = "确 定"]').click()
# time.sleep(5)
driver.quit()
